{% load static %}
<!DOCTYPE html>
<html lang="zh-CN"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="https://v3.bootcss.com/favicon.ico">

    <title>FeiuCRM</title>

    <!-- Bootstrap core CSS -->
    <link href="{% static 'bootstrap-3.3.7/css/bootstrap.css'%}" rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="{% static 'bootstrap-3.3.7/css/ie10-viewport-bug-workaround.css' %}" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="{% static 'bootstrap-3.3.7/css/dashboard.css' %}" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="{% static 'bootstrap-3.3.7/js/ie-emulation-modes-warning.js'%}"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    {% block css %}{% endblock %}
    {% block js %}{% endblock %}
  </head>

  <body>

    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">Feiu CRM</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
            <li><a href="#">功能一</a></li>
            <li><a href="#">功能二</a></li>

            {% if request.user.is_authenticated %}
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ request.user }}<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="#">用户信息</a></li>
                            <li role="separator" class="divider"></li>
                            <li class="dropdown-header">当前用户：{{ request.user }}</li>
                            <li><a href="{% url 'user_logout' %}">退出登录</a></li>
                        </ul>
                    </li>
                {% else %}
                    <li><a href="{% url 'user_login' %}">点击登录</a></li>
                {% endif %}

          </ul>
          <form class="navbar-form navbar-right">
            <input type="text" class="form-control" placeholder="Search...">
          </form>
        </div>
      </div>
    </nav>

    <div class="container-fluid">
        {% block body %}
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
          <ul class="nav nav-sidebar">
            <li class="active"><a href="#">激活的菜单</a></li>
            <li><a href="#">菜单一</a></li>
{#          {{ request.user.userprofile.role.all }}#}
            {% for role in request.user.userprofile.role.all %}
                    {% for menu in role.menus.all %}
                        {% if menu.url_type == 0 %}
                            <li {% if request.path == menu.url %} class="active" {% endif %}><a href="{{ menu.url }}">{{ menu.name }}</a></li>
                        {% else %}
                            {% url menu.url as menu_dynamic_url %}
                            <li {% if request.path == menu_dynamic_url %} class="active" {% endif %}><a href="{{ menu_url }}">{{ menu.name }}</a></li>
                        {% endif %}
                    {% endfor %}
                {% endfor %}
{#                    {% for role in request.user.userprofile.role.select_related %}#}
{#                        {% for menu in role.menus.select_related %}#}
{#                            <li><a href="{% if menu.url_type == 0 %}{{ menu.name }}{% else %}{% url menu.name %}{% endif %}">{{ menu.name }}</a></li>#}
{#                        {% endfor %}#}
{##}
{#                    {% endfor %}#}

          </ul>
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            {% block content %}
            {% endblock %}
        </div>
      </div>
        {% endblock %}
    </div>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="{% static 'bootstrap-3.3.7/js/jquery.js'%}"></script>
    <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
    <script src="{% static 'bootstrap-3.3.7/js/bootstrap.js'%}"></script>
    <!-- Just to make our placeholder images work. Don't actually copy the next line! -->
    <script src="{% static 'bootstrap-3.3.7/js/holder.js'%}"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="{% static 'bootstrap-3.3.7/js/ie10-viewport-bug-workaround.js'%}"></script>
  

</body></html>